﻿# strategy/ma_crossover.py
class MACrossoverStrategy:
    def generate_signal(self, df, idx):
        if idx < 1:
            return None
        ma5 = df['ma5']
        ma10 = df['ma10']
        if ma5.iloc[idx-1] < ma10.iloc[idx-1] and ma5.iloc[idx] > ma10.iloc[idx]:
            return 'buy'
        elif ma5.iloc[idx-1] > ma10.iloc[idx-1] and ma5.iloc[idx] < ma10.iloc[idx]:
            return 'sell'
        return None